using System;
using System.Web.UI;
using facebook;

namespace facebook.web
{
	public class CanvasIFrameBasePage : Page
	{
		private readonly API _api = new API();
		private string _apiKey;
		private bool _autoAdd = true;
		private string _secret;
		private bool _useSession = true;

		public string ApiKey
		{
			get { return _apiKey; }
			set { _apiKey = value; }
		}

		public string Secret
		{
			get { return _secret; }
			set { _secret = value; }
		}

		public bool UseSession
		{
			get { return _useSession; }
			set { _useSession = value; }
		}

		public bool AutoAdd
		{
			get { return _autoAdd; }
			set { _autoAdd = value; }
		}

		public API API
		{
			get { return _api; }
		}

		protected override void OnPreRender(EventArgs e)
		{
			Response.AppendHeader("P3P", "CP=\"CAO PSA OUR\"");
			base.OnPreRender(e);
		}

		protected void Page_Load(object sender, EventArgs e)
		{
			// ApplicationKey and Secret are acquired when you sign up for 
			_api.ApplicationKey = _apiKey;
			_api.Secret = _secret;

			BasePageHelper.LoadIFramePage(_api, _useSession, _autoAdd, Request, Response, Session);
		}
	}
}